import 'dart:io';

import 'package:flutter/cupertino.dart';
import 'package:flutter/services.dart';
import 'package:flutter1/pages/snake.dart';
import 'package:flutter1/pages/second_page.dart';
import 'package:flutter/material.dart';
import 'package:flutter1/config_wrapper.dart';
import 'package:flutter1/pages/sixth_page.dart';
import 'package:flutter1/pages/third_page.dart';
import 'package:flutter1/pages/fourth_page.dart';
import 'package:flutter1/pages/fifth_page.dart';
import 'package:flutter1/pages/seventh_page.dart';
import 'package:flutter1/pages/flappy_bird_page.dart';


import 'package:get/get.dart';

import 'pages/first_page.dart';

void main() {
  if (Platform.isAndroid) {
    SystemChrome.setSystemUIOverlayStyle(
        SystemUiOverlayStyle(statusBarColor: Colors.transparent));
  }
  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
  }

  var count = 0;

  @override
  Widget build(BuildContext context) {
    return GetMaterialApp(
      theme: ThemeData(
          primarySwatch: Colors.cyan


      ),
      debugShowCheckedModeBanner: false,
      initialRoute: '/first',
      routes: <String, WidgetBuilder>{

        '/first': (BuildContext ctx) => FirstPage(),
        '/second': (BuildContext ctx) => SecondPage(),
        '/third': (BuildContext ctx) => ThirdPage(),
        '/fourth': (BuildContext ctx) => FourthPage(),
        '/fifth': (BuildContext ctx) => FifthPage(),
        '/sixth': (BuildContext ctx) => SixPage(),
        '/seventh': (BuildContext ctx) => SeventhPage(),
        '/flappyBirdGame': (BuildContext ctx) => FlappyBirdPage(),
        '/snake': (BuildContext ctx) => Snake(),
      },
      //  分别两个路由
    );
  }
}

class WidgetA extends StatelessWidget {
  const WidgetA({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Row(
      children: [


        Container(
          child: Text('我只是一个组件'),
        ),
      ],
    );
  }
}

//这是一个实验InheritedWidget的组件
class WidgetB extends StatelessWidget {
  const WidgetB({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      child: Text(InheritedState.of(context)!.count.toString()),
    );
  }
}
